
/*
 * Copyright 2002-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2014原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans.factory;

/**
 * Callback interface triggered at the end of the singleton pre-instantiation phase
 * during {@link BeanFactory} bootstrap. This interface can be implemented by
 * singleton beans in order to perform some initialization after the regular
 * singleton instantiation algorithm, avoiding side effects with accidental early
 * initialization (e.g. from {@link ListableBeanFactory#getBeansOfType} calls).
 * In that sense, it is an alternative to {@link InitializingBean} which gets
 * triggered right at the end of a bean's local construction phase.
 *
 * <p>This callback variant is somewhat similar to
 * {@link org.springframework.context.event.ContextRefreshedEvent} but doesn't
 * require an implementation of {@link org.springframework.context.ApplicationListener},
 * with no need to filter context references across a context hierarchy etc.
 * It also implies a more minimal dependency on just the {@code beans} package
 * and is being honored by standalone {@link ListableBeanFactory} implementations,
 * not just in an {@link org.springframework.context.ApplicationContext} environment.
 *
 * <p><b>NOTE:</b> If you intend to start/manage asynchronous tasks, preferably
 * implement {@link org.springframework.context.Lifecycle} instead which offers
 * a richer model for runtime management and allows for phased startup/shutdown.
 *
 * @author Juergen Hoeller
 * @since 4.1
 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#preInstantiateSingletons()
 */
/**
 *在单例预实例化阶段结束时触发的回调接口
 *在｛@link BeanFactory｝引导期间。此接口可以通过以下方式实现
 *单例bean，以便在常规
 *单例实例化算法，避免意外早期的副作用
 *初始化（例如从｛@link ListableBeanFactory#getBeanOfType｝调用）。
 *从这个意义上说，它是｛@link InitializingBean｝的一个替代方案
 *在bean的本地构建阶段结束时触发。
 *
 *＜p＞此回调变量与
 *｛@link org.springframework.context.event.ContextRefreshedEvent｝但没有
 *需要实现{@link.org.springframework.context.ApplicationListener}，
 *不需要跨上下文层次结构等过滤上下文引用。
 *它还意味着对｛@codebeans｝包的依赖性更小
 *并且被独立的{@link ListableBeanFactory}实现所尊重，
 *而不仅仅是在{@link.org.springframework.context.ApplicationContext}环境中。
 *
 *<p><b>注意：</b>如果您打算启动/管理异步任务，最好
 *改为实现{@link.org.springframework.context.Lifecycle}，它提供
 *更丰富的运行时管理模型，允许分阶段启动/关闭。
 *
 *@作者Juergen Hoeller
 *@自4.1
 *@see org.springframework.beans.factory.config.ConfigableListableBeanFactory#preInstantiateSingletons（）
 */
public interface SmartInitializingSingleton {

	/**
	 * Invoked right at the end of the singleton pre-instantiation phase,
	 * with a guarantee that all regular singleton beans have been created
	 * already. {@link ListableBeanFactory#getBeansOfType} calls within
	 * this method won't trigger accidental side effects during bootstrap.
	 * <p><b>NOTE:</b> This callback won't be triggered for singleton beans
	 * lazily initialized on demand after {@link BeanFactory} bootstrap,
	 * and not for any other bean scope either. Carefully use it for beans
	 * with the intended bootstrap semantics only.
	 */
	/**
	 *在单例预实例化阶段结束时调用，
	 *保证所有常规的单例bean都已创建
	 *已经。｛@link ListableBeanFactory#getBeanOfType｝调用
	 *这种方法不会在引导过程中引发意外的副作用。
	 *<p><b>注意：</b>单例bean不会触发此回调
	 *在｛@link BeanFactory｝引导后按需延迟初始化，
	 *也不适用于任何其他bean范围。小心地将其用于豆类
	 *仅具有预期的引导语义。
	 */
	void afterSingletonsInstantiated();

}
